home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-01-03 | 20.3 KB | 562 lines | [TEXT/MACA] |
- Article 22 of comp.sys.mac.hypercard:
- Path: ucbvax!decvax!decwrl!pyramid!voder!apple!hyperbug
- From: hyperbug@apple.UUCP (Keith Rollin)
- Newsgroups: comp.sys.mac.hypercard,comp.sys.mac
- Subject: Windoid #3
- Keywords: Hypercard windoid newsletter
- Message-ID: <6586@apple.UUCP>
- Date: 30 Oct 87 22:23:47 GMT
- Organization: Apple Computer, Inc., Cupertino, USA
- Lines: 546
- Xref: ucbvax comp.sys.mac.hypercard:22 comp.sys.mac:8944
-
-
-
-
- WINDOID
- Issue #3
- The Publication for the Informed HyperCard User
- Editor: David Leffler
-
- Contents:
- INTRODUCTION
- EDITOR'S CHOICE
- HYPERCARD USER TIPS
- UNIVERSAL IMPORT BUTTON
- WHOOPS!
- THE FORM
-
- In this third issue of WINDOID, we will continue to cover importing text into
- HyperCard. Gary Bond, one of Apples outstanding HyperCard test team members,
- wrote a universal import button that takes into consideration nearly
- everything. You can now create a button that imports MacWrite, Microsoft
- Word, many database files, and even HyperCard stacks! We think you are going
- to enjoy this.
- Phil Wyman, another excellent Apple HyperCard tester, has provided us with more
- of his highly acclaimed power-user tips and has taken a stab at explaining some
- of the more interesting aspects of HyperCard properties.
- In the two previous issues, there were some mistakes. I would like to apologize
- for any inconvenience or frustration they might have caused and rectify them.
- The errata will appear on page seven under WHOOPS. I generally get all the text
- stuffed into the WINDOID newsletter moments before the Thursday meeting, and
- sometimes I miss something. Many of the excellent scripters that avidly read
- WINDOID have noticed my lapses and have provided me with needed repairs. For
- their kind assistance, I offer my thanks.
-
- WINDOID provides an opportunity for its readers to contribute to the ongoing
- growth and excellence of HyperCard. With your assistance we can continue to
- bring to HyperCard added depth and functionality. In the back of every issue
- will be a form for you to keep by your Macintosh. This form will allow you the
- unique opportunity to participate directly in the continued development of
- HyperCard.
-
- We will read all the forms returned and address questions that are being asked
- by HyperCard users. We will ask the team and provide you with an answer and
- publish the answers in this newsletter. In this way we can gather information
- and provide for your needs in future versions of HyperCard.
-
- WINDOID is trying to make a difference in the way that you work with HyperCard.
- We need your input. What sort of stacks are you using, what kinds of stacks
- are you creating, and what are some of the joys and frustrations you are
- experiencing. We really want to know!
-
- If you have a bug, suggestion, comment, or just want to know the best way to do
- something in HyperCard, you can fill out the form and send it to:
-
- AHUG c/o David Leffler
- Apple Computer, Inc.
- MS/27-AQ
- 20525 Mariani Ave.
- Cupertino, CA 95014
-
- Or copy the format and Apple-Link it to: HYPERBUG$
-
- EDITOR'S CHOICE
- by David Leffler
-
- At the last Apple HyperCard User Group meeting , Danny Goodman, author of The
- Complete HyperCard Handbook, presented to an appreciative audience his
- incredible business productivity stack Focal Point. It will be released soon
- by Activision. We were all amazed at the incredible graphics and awesome
- features he has scripted into it. Danny, as you might know, is not a programmer
- and has always been frustrated by his inability to turn his ideas into
- software. HyperCard has empowered him to not only turn his ideas into reality,
- but to allow him the opportunity to share his ideas with the world. Thank you
- Danny!
-
- Amanda Goodenough, author of the Inigo and My Favorite Camel series of
- wonderful adventures, was also on hand. Her obvious love of stories and great
- presentation style captivated the audience. Amanda continues to enhance and
- produce more of these non-textual stories and has graciously allowed us to
- place them in an Amandas Stacks folder on the AHUG StackWare server. My
- Favorite Camel is a favorite of mine, and I think everyone should see it and
- share it with someone they love.
-
- There are two other stacks on the StackWare server that also deserve serious
- attention. The AIDS stack is a perfect representation of how HyperCard can be
- used in an incredibly invocative eye and heart grabbing style. This stack is
- not only visually and emotionally gripping, but is an excellent example of how
- to use HyperCard as a powerful vehicle to move you through diverse information.
- You should get this stack.
-
- Finally, Tree Frog Studio software presents CheapSequencer. Tree Frog has
- given us a music sequencer that must be seen and heard to be believed. These
- innovative stackware developers are interested in entertaining us with great
- graphics and functional stackware tools.
- Its stacks and people like these that really show the power and versatility of
- HyperCard.
-
- POWERUSERS TIPS
- by Phil Wyman
-
- 1. If you get tired of pulling the Tools Windoid off of the menubar when you
- need it, try Option-Tab, which will tear it off for you! Also, if the Tools
- Windoid is in a paint tool, hitting Tab will tear off the Patterns Windoid.
-
- 2. If you have a line in your script that is longer than the editor window,
- you can place an Option-Return at a space in the line to break it into two
- smaller lines. The two lines will execute in the same way as the original
- line. (Do not place the Option-Return into the middle of a quoted string.
- Also, if you use the Option-Return in a comment, remember that every line of a
- comment must start with a double hyphen!)
-
- 3. For those programmers out there who are used to for next loops, there is
- a next repeat command in HyperTalk which works in a repeat loop a lot like a
- next command in a for next loop. The next repeat command does not
- execute anything that follows it in the repeat loop, but rather starts
- executing at the beginning of the repeat loop.
- Also, if you wish to exit the repeat loop altogether, without executing anymore
- of the lines in the repeat loop, then use exit repeat.
-
- Note:
- If you want to exit the entire message handler from anywhere in the handler,
- use exit <handlername> (i.e., exit mouseup).
- If you wish to leave the handler but wish the current message to be sent on up
- the hierarchical path from where it is now, then use pass <handlername>.
-
- 4. When concatenating two strings, you can add a space between the two
- strings by using two ampersands && instead of just one &.
-
- 5. A shorthand for button in HyperTalk is btn. A shorthand for
- background is bkgnd.
-
- 6. You can copy buttons, fields, backgrounds or cards between stacks. This is
- a very powerful feature of HyperCard.
-
- 7. For those of you with the regular size Mac Plus or Mac SE screens, try this
- for a thrill:
- Set loc of cardWindow to 10,50
- You will see what people on large screens see all the time, a window title bar
- which states the pathname of the window you are viewing. (To reset your
- cardWindow, Set loc of cardWindow to 0,0.)
-
- 8. If you are in any tool other than the Browse tool, you can return to the
- Browse tool by Command-Tab.
-
- 9. When you are in the Button tool, you can Command-Drag to create a new
- button. Option-Drag on a button and you will drag a copy of the button.
-
- 10. A first attempt at a small treatise on the use of the,of, and () in
- HyperTalk:
-
- In general, either the, of, or parentheses () are required to signal
- HyperTalk that a function or property is to be activated.
-
-
- PROPERTIES:
- With button, card, background, stack, and window properties, the is optional,
- but you need of. Also, properties never have parentheses. You can say:
- put hilite of button 1
- put the hilite of button 1
-
- Since there is no of to activate it, you cannot say:
- put the hilite button 1
-
- If you are using a global or painting property, you need the, since there is
- no of to activate the property. For instance, you can say:
- put the lockScreen
- put the textAlign
-
- However, you cannot put the property by saying:
- put lockScreen
- because HyperCard will think you are using lockScreen as a variable, not a
- property.
-
- FUNCTIONS:
-
- Either the, of, or parentheses () are required with a function.
-
- However, you cannot mix the with parentheses in a system function. For
- instance, you cannot say:
- put the charToNum(a)
-
- You are allowed to say:
- put the chartonum of a
- put chartonum(a)
- put the chartonum of (a)
- If a system function has more than one argument, it will always require
- parentheses. For user-defined functions, you must always use parentheses, even
- if there are no argumentsi.e., userFunction().
- If a function does not use of or (), then the is required! For example,
- date doesnt work without the, since there is not an of or () to
- activate the function. You can say:
- put the date
-
- But you cannot say:
- put date
- because HyperTalk will assume that date is a variable. This concept of
- insisting on a the to activate the function allows for future expansion of
- more system functions, since system functions will not be able to collide with
- variables that users already have in their scripts.
-
- The UNIVERSAL IMPORT BUTTON
- by Gary Bond
- Rev. 2.2
-
- Last issue we dealt with importing text. While those approaches are reliable,
- they are also very slow and dont account for a number of problems that might
- occur along the way. Consistent with our goal to provide you with the best,
- this issue contains a script for a universal import button which does both
- kinds of import (text and data). To use it, type it into any button script.
-
- In addition to importing text files it also imports Macwrite and Word documents
- and even Hypercard stacks! This version of the import button fixes bugs both in
- Hypercard and in previous button versions.
-
-
-
- on mouseUp
- global cardcount,startcard,memory,header
- get userlevel
- put it into item 1 of memory
- set userlevel to 5
- set lockmessages to true
- set lockscreen to true
- put short id of this card into startcard
- answer Import text file as: with Data or Text or Cancel
- if it is Cancel then Cleanexit
- if it is Text then
- answer Include header information in fields? with Yes or No
- put it into header
- Importext
- else
- Importdata
- end if
- go next card
- Cleanexit Compact
- end mouseup
-
- on importext
- global cardcount,startcard,memory,header
- put 0 into cardcount
- repeat
- ask Name or pathname of text file to import: with item 2 of memory
- if short name of this stack is in it then
- if , is not in memory then put , after memory
- put it into item 2 of memory
- answer Cant import current stack! with Ok
- next repeat
- end if
- if it is empty then
- Cleanexit
- else
- exit repeat
- end if
- end repeat
- put it into filename
- if , is not in memory then put , after memory
- put it into item 2 of memory
- set cursor to 4
- open file filename
- repeat
- read from file filename for 16384
- if it is empty and cardcount is 0 then
- answer Could not find file: & filename with Ok
- close file filename
- Cleanexit
- end if
- if it is empty then exit repeat
- put return after it
- domenu New card
- add 1 to cardcount
- domenu New field
- set name of card field (number of card fields) to Import
- set style of card field Import to scrolling
- drag from the loc of card field Import to 0,62
- drag from 190,100 to 512,342
- if header is Yes then
- put Characters: && number of chars in it & return & return before it
- put Lines: && number of lines in it & return before it
- put File: && filename & return before it
- put Import card: && cardcount & return before it
- end if
- put it into card field Import
- end repeat
- close file filename
- if header is Yes then
- repeat until the short id of this card is startcard
- put of && cardcount after line 1 of card field Import
- go previous card
- end repeat
- else
- go card id startcard
- end if
- end importext
-
- on importdata
- global filename,cardcount,startcard,memory,header
- put empty into delimiters
- put empty into filename
- put 0 into cardcount
- put 0 into limit
- put 0 into fieldcount
- repeat until delimiters is not empty
- put 0 into nofields
- answer Use Tab and Return as delimiters? with Yes or Other or
- Cancel
- if it is Cancel then mouseup
- if it is Yes then put 9,13 into delimiters
- if it is Other then
- repeat until ((item 1 of it > 0 and item 1 of it < 256)
- and (item 2 of it > 0 and item 2 of it < 256)) or it is empty
- ask Enter two comma separated Ascii delimiters: with empty
- put it into delimiters
- end repeat
- end if
- end repeat
- if item 1 of delimiters is item 2 of delimiters then put 1 into nofields
- answer Include header information in fields? with Yes or No
- put it into header
- repeat
- ask Name or pathname of text file to import: with item 2 of memory
- if short name of this stack is in it then
- if , is not in memory then put , after memory
- put it into item 2 of memory
- answer Cant import current stack! with Ok
- next repeat
- end if
- if it is empty then
- if cardcount > 0 then
- close file filename
- CleanExit
- end if
- Importdata
- else
- exit repeat
- end if
- end repeat
- put it into filename
- if , is not in memory then put , after memory
- put it into item 2 of memory
- set cursor to 4
- open file filename
- repeat
- read from file filename until (numtochar of item 2 of delimiters)
- if it is empty and cardcount is 0 then
- answer Could not find file: & filename with Ok
- close file filename
- Cleanexit
- end if
- if it is empty then exit repeat
- if chartonum(last character of it) is not item 2 of delimiters then
- put item 2 of delimiters into temp
- if temp is 9 then put Tab into temp
- if temp is 13 then put Return into temp
- answer Cant find record delimiter: && temp with Ok
- close file filename
- cleanexit
- end if
- put empty into last character of it
- if (numtochar of item 1 of delimiters) is not in it and nofields is 0 then
- put item 1 of delimiters into temp
- if temp is 9 then put Tab into temp
- if temp is 13 then put Return into temp
- answer Cant find field delimiter: && temp with Help or Ok
- if it is help then
- answer Use double record delimiters for records... with Continue
- answer with no field delimiters. Example: 13,13 with Ok
- end if
- close file filename
- Cleanexit
- end if
- if (numtochar of item 1 of delimiters) is not , and nofields is 0 then
- repeat until (numtochar of item 1 of delimiters) is not in it
- put , into character offset((numtochar of item 1 of delimiters),it)
- of it
- end repeat
- end if
- if cardcount is 0 then
- domenu New background
- else
- domenu New card
- end if
- add 1 to cardcount
- if nofields is 0 then
- put the number of items in it into limit
- else
- put nofields into limit
- end if
- repeat with count = 1 to limit
- if cardcount is 1 then
- add 1 to fieldcount
- if fieldcount < 125 then
- domenu New field
- else
- answer No more fields can be created! with Ok
- Cleanexit Compact
- end if
- end if
- put Field & count into fieldname
- set name of bkgnd field (number of bkgnd fields) to fieldname
- set style of bkgnd field fieldname to scrolling
- If nofields is 0 and header is Yes then
- put Field && count && of && the number of items in it & return into
- bkgnd field fieldname
- put Record && cardcount && of file: && filename & return & return
- after bkgnd field fieldname
- end if
- if nofields is 0 then
- put item count of it & return after bkgnd field fieldname
- else
- put it & return after bkgnd field fieldname
- end if
- end repeat
- choose browse tool
- end repeat
- close file filename
- go card id startcard
- end importdata
-
- on Cleanexit var
- global memory
- if param(1) is compact then
- domenu Compact stack
- end if
- choose browse tool
- set userlevel to item 1 of memory
- set lockscreen to false
- set lockmessages to false
- exit to hypercard
- end Cleanexit
-
- We hope that this script will aid in your productivity with HyperCard. Please
- let us know how you like it.
-
-
- WHOOPS
- by David Leffler
-
- An errata from the first two issues of WINDOID.
-
- ISSUE #1:
-
- In the first issue Gary Bond showed us how to find out which line of a
- scrolling field the user has clicked on. Apple employee Brian McGhie found a
- small flaw and wrote me the following letter:
-
- The question was asked, How can I find out which line of a field a user has
- clicked in? The response was a method that would work in static fields, and
- then further developed into a method for scrolling fields. The function
- Clickline as given for scrolling windows only works if the scrolling field is
- (in pixels) an integer multiple of the textheight. A corrected version of
- Clickline appears below.
-
- Function Clickline
- return (trunc(((scroll of the target)
- + (item two of the clickloc)
- - (item two of the rect of the target))
- div the textheight of the target) + one)
- End Clickline
-
- The idea is to calculate the number of pixels from the top of the field to the
- position that you clicked on. So you take the number of pixels that have
- scrolled offscreen, and add in the vertical position of the mouseclick minus
- the vertical position of the top of the field. This sum is the total number of
- pixels from the logical top of the window not the visual top. Divide by the
- height of the font to get the number of lines. Since this number is not always
- an integer, truncate it. The result is a zero based count of lines. Add one and
- return the correct line number that was clicked in.
-
- ISSUE #2:
-
- Robin Shank provided us with a How to Program FunctionKeys in HyperTalk
- script. We left out a word, and the script will not work without it. The
- script should read:
-
- On functionkey whatkey
- if whatkey is 6 then
- type x with commandkey Cut whatever is selected
- domenu background enter the background
- type v with commandkey Paste it
- domenu background leave the background
- else
- pass functionkey
- end if
- end functionkey
-
-
- We hope you have enjoyed reading WINDOID and have found it to be interesting
- and informative. We care enough to take the time to give you the most
- up-to-date information about HyperCard, and we would like to make a request for
- a little of your time. There is a form that follows this editorial; please fill
- it out if you will. We are very interested in hearing from you. What sort of
- stacks are you using, what kind of stacks are you creating, and what are your
- joys and frustrations in using HyperCard.
- You have the unique opportunity to communicate directly with Bill, Dan, and the
- entire HyperCard development team. We really want to know what you would like
- to see in HyperCard and are more than willing to give you what you want. What
- we need to make this happen is your input. Let us know what you think. We can
- address it in WINDOID or perhaps the next revision of HyperCard. You can make a
- difference in the world by communicating with us. Dont pass up the
- opportunity!
-
- The form:
-
- Please use the following form to make a difference in the world:
-
- Date:
- Name:
- Address:
- Phone #:
- Versions of:
- a. HyperCard:
- b. Associated software:
- c. System Software:
- 1. System
- 2. Finder
- 3. ImageWriter file
- 4. LaserWriter file
- 5. Any others
- Type of Macintosh:
- Peripherals:
- Description of problem, suggestions or comments:
-
-
- Fill this out and send it to:
-
- AHUG
- C/O David Leffler
- Apple Computer Inc.
- MS 27AQ
- 20525 Mariani Ave.,
- Cupertino, CA 95014
-
- Or copy the format and AppleLink it to:
-
- HYPERBUG$
-
- We thank you for your participation and know that you will be pleased to see
- your ideas, comments, and suggestions appear in future issues of WINDOID, the
- publication for the informed HyperCard user.
-
-
- --
-
- Apple's HyperCard Grievance Center
- "Give us your bugs, your comments, your gentle criticisms..."
-
- UUCP: {pyramid!sun,voder,nsc,ucbvax!mtxinu,dual,decwrl,amdahl}!apple!hyperbug
-
-